package guda.sqladmin.web.form;

import guda.sqladmin.dao.domain.TableFieldDO;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;

public class TableFieldForm {

    @NotNull
    private Long tableId;

    private Integer fieldLength;

    private String defaultValue;

    @NotEmpty(message = "{不能为空}")
    private String fieldDesc;

    @NotNull
    private Integer notNull;

    @NotEmpty(message = "{不能为空}")
    private String fieldType;

    @NotEmpty(message = "{不能为空}")
    private String fieldName;

    private Byte isKey;

    private Byte isAutoIncre;

    public Byte getIsKey() {
        return isKey;
    }

    public void setIsKey(Byte isKey) {
        this.isKey = isKey;
    }

    public Byte getIsAutoIncre() {
        return isAutoIncre;
    }

    public void setIsAutoIncre(Byte isAutoIncre) {
        this.isAutoIncre = isAutoIncre;
    }

    public Long getTableId() {
        return tableId;
    }

    public void setTableId(Long tableId) {
        this.tableId = tableId;
    }

    public Integer getFieldLength() {
        return fieldLength;
    }

    public void setFieldLength(Integer fieldLength) {
        this.fieldLength = fieldLength;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    public String getFieldDesc() {
        return fieldDesc;
    }

    public void setFieldDesc(String fieldDesc) {
        this.fieldDesc = fieldDesc;
    }

    public Integer getNotNull() {
        return notNull;
    }

    public void setNotNull(Integer notNull) {
        this.notNull = notNull;
    }

    public String getFieldType() {
        return fieldType;
    }

    public void setFieldType(String fieldType) {
        this.fieldType = fieldType;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public TableFieldDO toDO() {
        TableFieldDO tableFieldDO = new TableFieldDO();
        tableFieldDO.setFieldLength(this.fieldLength);
        tableFieldDO.setDefaultValue(this.defaultValue);
        tableFieldDO.setFieldDesc(this.fieldDesc);
        tableFieldDO.setNotNull(this.notNull);
        tableFieldDO.setFieldType(this.fieldType);
        tableFieldDO.setFieldName(this.fieldName);
        tableFieldDO.setIsAutoIncre(this.isAutoIncre);
        tableFieldDO.setIsKey(this.isKey);
        return tableFieldDO;
    }

}
